#ifndef __NJGIS_NJMOLDESERVICEINSTANCE_H__
#define __NJGIS_NJMOLDESERVICEINSTANCE_H__

#include "../include/INxModelServiceInstance.h"
#include "NxService.h"

namespace NJGIS
{
	namespace SERVICE
	{
		class NjModelServiceInstance : public virtual INjModelServiceInstance, public virtual NjService
		{
		public:

			NjModelServiceInstance(
				const char* state,
				const char* eventname,
				const char* guid,
				const char* startDT,
				const char* serviceID,
				const char* ip,
				int port,
				std::vector<INjRunningLog*>* logs = NULL,
				NjModelInstanceStatus status = NJGIS::SERVICE::INSTA_UNKNOWN,
				const char* statusDes = ""
				):
				_state(state),
				_event(eventname),
				_guid(guid),
				_startDT(startDT),
				_serviceID(serviceID),
				_status(status),
				_statusDes(statusDes),
				NjService(ip, port)
			{
				this->_logs = new std::vector<INjRunningLog*>();
				if(logs != NULL)
				{
					for (int i = 0; i < logs->size(); i++)
					{
						this->_logs->push_back((*logs)[i]);
					}
				}
			};

			~NjModelServiceInstance()
			{
				delete this->_logs;
			};

			virtual const char* getCurrentState();

			virtual const char* getCurrentEvent();

			virtual const char* getGUID();

			virtual const char* getStartTime();

			virtual const char* getModelServiceID();

			virtual std::vector<INjRunningLog*>* getLogs();

			virtual std::vector<INjRunningLog*>* getNewLogs();

			virtual NjModelInstanceStatus getStatus();

			virtual int kill();

			virtual int pause();

			virtual int restart();

			virtual int refresh();

			virtual int wait4Status(NJGIS::SERVICE::NjModelInstanceStatus status, double timeout = 7200, bool log = false);

		private:

			std::string _startDT;

			std::string _serviceID;

			//! dynamic
			std::string _state;

			//! dynamic
			std::string _event;

			//! dynamic
			std::string _guid;

			//! dynamic
			std::vector<INjRunningLog*>* _logs;

			//! dynamic
			NjModelInstanceStatus _status;

			//! dynamic
			std::string _statusDes;
		};
	}
}

#endif